﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

using FRL.DebtChased.Repository;
using FRL.DebtChased.Silverlight.Library;

namespace FRL.DebtChased.Types
{

	/// <summary>
	/// Extension class for Money class
	/// </summary>
	public partial class Money
	{

		/////////////////////////////////////////////////////////////
		// Static Operations

		public static void LoadCurrencyControl(ComboBox ctrl, bool bAddNotSet)
		{

			// Add currency
			if (bAddNotSet)
				ctrl.Items.Add(new ComboBoxObject(Definitions.NotSet, 0, null));
			ctrl.Items.Add(new ComboBoxObject("GBP(£)", 0, CurrencyToCode(eCurrency.Sterling)));
			ctrl.Items.Add(new ComboBoxObject("USD($)", 0, CurrencyToCode(eCurrency.USDollar)));
			ctrl.Items.Add(new ComboBoxObject("EUR(€)", 0, CurrencyToCode(eCurrency.Euro)));
			ctrl.Items.Add(new ComboBoxObject("YEN(¥)", 0, CurrencyToCode(eCurrency.Yen)));

		}

		public static string SafeGetCurrencyCode(ComboBox cboCurrency)
		{

			// Declare return variable
			string strFtmp = null;

			// Get selected object
			ComboBoxObject cbo = (cboCurrency.SelectedValue as ComboBoxObject);
			if (cbo.Tag != null)
				strFtmp = cbo.Tag.ToString();

			// Return variable
			return strFtmp;

		}

	}

}
